import dayjs from 'dayjs'
// import mixin from '@/mixins'
import store from '@/store'
export default {
  install(Vue) {
    Vue.directive('imgError', {
      inserted: function(el, { value }) {
        // el获取当前DOM元素
        el.onerror = function() {
          el.src = value
        }
      }
    })
    Vue.filter('dayFormat', (val) => {
      return dayjs(val).format('YYYY-MM-DD')
    })
    // Vue.mixin(mixin)
    Vue.directive('showEle', {
      inserted: function(el, { value }) {
        const points = store.state.user.userInfo.roles.points
        const flag = points.includes(value)
        if (!flag) {
          // el.style.display = 'none'
          el.parentNode.removeChild(el)
        }
      }
    })
  }

}
